package com.im.easy.rxeasyandroidHelper;

import android.app.Application;

import com.im.easy.rxeasyandroidHelper.common.di.AppCommonComponent;
import com.im.easy.rxeasyandroidHelper.common.di.AppCommonModule;
import com.im.easy.rxeasyandroidHelper.common.di.DaggerAppCommonComponent;
import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;

/**
 * Created by wujiajun on 17/4/6.
 */

public class AppApplication extends Application {

    AppCommonComponent aComponent;

    @Override
    public void onCreate() {
        super.onCreate();
        aComponent = DaggerAppCommonComponent.builder().appCommonModule(new AppCommonModule(this)).build();
        //Rx全局异常处理
        RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
            @Override
            public void accept(Throwable e) {
              e.printStackTrace();
            }});
    }

    public AppCommonComponent getAppComponent() {
        return aComponent;
    }



}
